#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;
int main()
{
    int a = 0;
    int b = 0;
    int ret = 0;
    scanf("%d %d", &a, &b);
    for (int i = a; i <= b; i++)
    {
        int value = i;
        while (value)
        {
            if (value % 10 == 2)
                ret++;
            value /= 10;
        }
    }
    cout << ret << endl;
    return 0;
}